import { AigcMoney } from '@/types'
import { createSlice, createAsyncThunk, PayloadAction } from '@reduxjs/toolkit'
const initialState: AigcMoney = {
  blance: 0,
  date: new Date().getDate()
}
export const aigcUpto = createAsyncThunk(
  'money/upto',
  async (uptoNum: number | string, thunkAPI) => {
    return uptoNum
  }
)
export const moneySlice = createSlice({
  name: 'money',
  initialState,
  reducers: {},
  extraReducers(builder) {
    builder.addCase(aigcUpto.fulfilled, (state, action) => {
      console.log('fulfilled', action.payload)
      state.blance = action.payload
      state.date = new Date().getDate()
    })
  }
})

export default moneySlice.reducer
